/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.generarhorario.itschapala.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author RaygozaL
 */
@Entity
@Table(name = "materia")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Materia.findAll", query = "SELECT m FROM Materia m"),
    @NamedQuery(name = "Materia.findByIdMateria", query = "SELECT m FROM Materia m WHERE m.idMateria = :idMateria"),
    @NamedQuery(name = "Materia.findByHoraPractica", query = "SELECT m FROM Materia m WHERE m.horaPractica = :horaPractica"),
    @NamedQuery(name = "Materia.findByHoraTeorica", query = "SELECT m FROM Materia m WHERE m.horaTeorica = :horaTeorica"),
    @NamedQuery(name = "Materia.findByNombre", query = "SELECT m FROM Materia m WHERE m.nombre = :nombre"),
    @NamedQuery(name = "Materia.findByNumAlumnos", query = "SELECT m FROM Materia m WHERE m.numAlumnos = :numAlumnos"),
    @NamedQuery(name = "Materia.findByNombreProfesor", query = "SELECT m FROM Materia m WHERE m.nombreProfesor = :nombreProfesor"),
    @NamedQuery(name = "Materia.findDuplicity", query ="SELECT m FROM Materia m WHERE m.nombre = :nombre")
})
public class Materia implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idMateria")
    private Integer idMateria;
    @Column(name = "horaPractica")
    private Integer horaPractica;
    @Column(name = "horaTeorica")
    private Integer horaTeorica;
    @Size(max = 45)
    @Column(name = "nombre")
    private String nombre;
    @Size(max = 45)
    @Column(name = "numAlumnos")
    private String numAlumnos;
    @Size(max = 45)
    @Column(name = "nombreProfesor")
    private String nombreProfesor;
    @JoinColumn(name = "Salon_idSalon", referencedColumnName = "idSalon")
    @ManyToOne(optional = false)
    private Salon salonidSalon;
    @JoinColumn(name = "Profesor_idProfesor", referencedColumnName = "idProfesor")
    @ManyToOne(optional = false)
    private Profesor profesoridProfesor;

    public Materia() {
    }

    public Materia(Integer idMateria) {
        this.idMateria = idMateria;
    }

    public Integer getIdMateria() {
        return idMateria;
    }

    public void setIdMateria(Integer idMateria) {
        this.idMateria = idMateria;
    }

    public Integer getHoraPractica() {
        return horaPractica;
    }

    public void setHoraPractica(Integer horaPractica) {
        this.horaPractica = horaPractica;
    }

    public Integer getHoraTeorica() {
        return horaTeorica;
    }

    public void setHoraTeorica(Integer horaTeorica) {
        this.horaTeorica = horaTeorica;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getNumAlumnos() {
        return numAlumnos;
    }

    public void setNumAlumnos(String numAlumnos) {
        this.numAlumnos = numAlumnos;
    }

    public String getNombreProfesor() {
        return nombreProfesor;
    }

    public void setNombreProfesor(String nombreProfesor) {
        this.nombreProfesor = nombreProfesor;
    }

    public Salon getSalonidSalon() {
        return salonidSalon;
    }

    public void setSalonidSalon(Salon salonidSalon) {
        this.salonidSalon = salonidSalon;
    }

    public Profesor getProfesoridProfesor() {
        return profesoridProfesor;
    }

    public void setProfesoridProfesor(Profesor profesoridProfesor) {
        this.profesoridProfesor = profesoridProfesor;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMateria != null ? idMateria.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Materia)) {
            return false;
        }
        Materia other = (Materia) object;
        if ((this.idMateria == null && other.idMateria != null) || (this.idMateria != null && !this.idMateria.equals(other.idMateria))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.generarhorario.itschapala.modelo.Materia[ idMateria=" + idMateria + " ]";
    }
    
}
